# -*- coding: utf-8 -*-
# author:HHR
# time:2020/12/9:15:09
# ___msg___ = '数据库连接'



class DB_connect():
    def local_redis_connect(self):
        import redis
        local_redis = redis.Redis(host="localhost", port=6379, db=0, decode_responses=True)
        return local_redis

    def ipc_redis_connect(self):
        import redis
        ipc_redis = redis.Redis(host="localhost", port=6379, db=15, decode_responses=True)
        return ipc_redis

    def xhhg_mysql_local(self):
        import pymysql
        conn = pymysql.connect(host="192.168.1.58", port=3306, user='root', db="patent_information", use_unicode=True,  charset='utf8')
        return conn

    def online_db(self):
        import pymysql
        conn = pymysql.connect(host="112.125.25.114", port=3306, user='python', password='pythonselect', db="mykhadmin", use_unicode=True, charset='utf8')
        return conn

    def IP_reids(self):
        import redis
        local_redis = redis.Redis(host="121.4.69.146", password='xhhg123456', port=6389, db=0, decode_responses=True)
        return local_redis

    def gongju(self):
        import redis
        local_redis = redis.Redis(host="121.4.69.146", password='xhhg123456', port=6389, db=3, decode_responses=True)
        return local_redis

    def patents_reids(self):
        import redis
        patents_con = redis.Redis(host="121.4.69.146", password='xhhg123456', port=6389, db=2, decode_responses=True)
        return patents_con

    def online_big_data(self):
        import pymysql
        conn = pymysql.connect(host="121.4.69.146", user='root', password='xhhg@2020', port=3306, db="big_data", use_unicode=True, charset='utf8')
        return conn

    def mysql_mykh(self):
        import pymysql
        mysql_mykh = pymysql.connect(host='112.125.25.114', port=3306, user="python", password="pythonselect", database="mykhadmin")
        return mysql_mykh

    def ccy_db(self):
        import pymysql
        conn = pymysql.connect(host="192.168.110.49", user='root', password='', port=3306, db="ccy_test", use_unicode=True, charset='utf8')
        return conn
